﻿using System.Collections.Generic;
using System.Data;

namespace Extensions
{
    public static class DataExtensions
    {
        public static void RemoveSystemCols(this DataTable table)
        {
            List<string> colsToDelete = new List<string>();
            foreach (DataColumn col in table.Columns)
            {
                string colName = col.ColumnName.Trim().ToLower();
                if (colName == "modifiedon" || colName == "ts" || colName == "userıd" || colName == "deleted")
                {
                    colsToDelete.Add(col.ColumnName);
                }
            }
            foreach (string colToDelete in colsToDelete)
            {
                table.Columns.Remove(colToDelete);
            }
        }
    }
}